package com.xiaoq.shop.entity;

import com.xiaoq.MongoEntity;
import com.xiaoq.shop.dto.TagsDTO;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.NotEmpty;
import org.mongodb.morphia.annotations.Embedded;
import org.mongodb.morphia.annotations.Entity;
import org.mongodb.morphia.annotations.Indexed;

import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;

/**
 * @author xinpeng created on 16/9/18-上午10:47.
 *
 * 一个商品详情对应一个SPU,商品详情需要列出价格时,一般都取最低价格
 *
 * 在商品详情页,当顾客将当前商品加入购物车或者直接下订单时,会首先弹出一个选择规格的页面,此页面可能会出现穷举规格或者列出2层或3层规格,然后
 * 后台做笛卡尔积,笛卡尔积的元素个数就是sku的个数
 */

@Entity(value = "spu_collection" ,noClassnameStored = true)
public class SPUEntity extends MongoEntity {

    @ApiModelProperty(hidden = true)
    private String userId; //小店店主的用户id

    @Indexed
    private String shopId;//小店id

    private List<String> slidingImageUrls;  //商品详情页的顶部轮播图片,一般会每个款式、颜色会选择一副图片,但是一般不超过4幅图片

    @NotEmpty(message = "product name null")
    private String spuName;//spu名称,即商品名称

    private String spuCode;//spu编码,即商品编码

    @NotNull(message = "product type null")
    private String catalogCode; //类目编码

    private String catalogName; //类目名称

    private String spuCatalogCode; //spu分类编码

    private String spuCatalogName; //spu分类名称

    private String brandCode; //品牌编码

    private String brandName; //品牌名称

    private String description; //商品描述

    private Float expressFee = 0f;  //运费,目前只支持商家全包,即运费为0

    private List<TagsDTO> tags; //商品标签

    @Embedded
    private List<SPUReviewEntity> spuReviews = new ArrayList<>(); //商品评论

    private Integer  imageTextIsExist; //1 存在 0不存在

    private Integer saleState = 1 ;  //商品销售状态  1:上架中;-1:已下架;

    /**
     * 讲解员ID
     */
    private String interpreterId;

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getShopId() {
		return shopId;
	}

	public void setShopId(String shopId) {
		this.shopId = shopId;
	}

	public List<String> getSlidingImageUrls() {
		return slidingImageUrls;
	}

	public void setSlidingImageUrls(List<String> slidingImageUrls) {
		this.slidingImageUrls = slidingImageUrls;
	}

	public String getSpuName() {
		return spuName;
	}

	public void setSpuName(String spuName) {
		this.spuName = spuName;
	}

	public String getSpuCode() {
		return spuCode;
	}

	public void setSpuCode(String spuCode) {
		this.spuCode = spuCode;
	}

	public String getCatalogCode() {
		return catalogCode;
	}

	public void setCatalogCode(String catalogCode) {
		this.catalogCode = catalogCode;
	}

	public String getCatalogName() {
		return catalogName;
	}

	public void setCatalogName(String catalogName) {
		this.catalogName = catalogName;
	}

	public String getSpuCatalogCode() {
		return spuCatalogCode;
	}

	public void setSpuCatalogCode(String spuCatalogCode) {
		this.spuCatalogCode = spuCatalogCode;
	}

	public String getSpuCatalogName() {
		return spuCatalogName;
	}

	public void setSpuCatalogName(String spuCatalogName) {
		this.spuCatalogName = spuCatalogName;
	}

	public String getBrandCode() {
		return brandCode;
	}

	public void setBrandCode(String brandCode) {
		this.brandCode = brandCode;
	}

	public String getBrandName() {
		return brandName;
	}

	public void setBrandName(String brandName) {
		this.brandName = brandName;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Float getExpressFee() {
		return expressFee;
	}

	public void setExpressFee(Float expressFee) {
		this.expressFee = expressFee;
	}

	public List<TagsDTO> getTags() {
		return tags;
	}

	public void setTags(List<TagsDTO> tags) {
		this.tags = tags;
	}

	public List<SPUReviewEntity> getSpuReviews() {
		return spuReviews;
	}

	public void setSpuReviews(List<SPUReviewEntity> spuReviews) {
		this.spuReviews = spuReviews;
	}

	public Integer getImageTextIsExist() {
		return imageTextIsExist;
	}

	public void setImageTextIsExist(Integer imageTextIsExist) {
		this.imageTextIsExist = imageTextIsExist;
	}

	public Integer getSaleState() {
		return saleState;
	}

	public void setSaleState(Integer saleState) {
		this.saleState = saleState;
	}

	public String getInterpreterId() {
		return interpreterId;
	}

	public void setInterpreterId(String interpreterId) {
		this.interpreterId = interpreterId;
	}

}


